package world;

/**
 * defines an object that should be replicated and maintained over the network,
 * this object should be managed by the game {@link world.World world}
 * @author jack
 *
 */
public abstract class NetworkObject
{
	/**
	 * the network id used to reference the object in all worlds
	 */
	private short id;
	
	public NetworkObject(short id)
	{
		this.id = id;
	}
	/**
	 * gets the network ID of the object, the network ID is the reference that
	 * each world uses to determine which object a given command refers to
	 * @return returns the object ID
	 */
	public short getID()
	{
		return id;
	}
	/**
	 * updates the network object, this method should only be called in the
	 * world that has ownership of the object
	 * @param w
	 * @param tdiff
	 */
	public abstract void update(World w, double tdiff);
	/**
	 * simulates the network object, for worlds that do not have ownership of
	 * the object, makes predictions on the dynamic state of the object
	 * @param w
	 * @param tdiff
	 */
	public abstract void simulate(World w, double tdiff);
}
